﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Windows.Forms;

using System.Drawing;
namespace AI.EditMode
{
    public class AddKIAPoint :iEditMode
    {

        Point _CurPoint = null;

        public AddKIAPoint(AIInfo Form) :
            base( Form)
        {
            _Cur_Pen = new Pen(Color.Blue, 2f);


            foreach (int index in _Form._MIM._KiaPoint)
            {
                Point point = _Form._MIM._BaseNode._PointList[index];

                _Form.listBox_KiaPoint.Items.Add(point);
            }


            _Form.BtnAddKIAPoint.Click += new EventHandler(BtnAddKIAPoint_Click);
            _Form.BtnRemoveKIAPoint.Click += new EventHandler(BtnRemoveKIAPoint_Click);

        }

        void BtnRemoveKIAPoint_Click(object sender, EventArgs e)
        {
            
        }

        void BtnAddKIAPoint_Click(object sender, EventArgs e)
        {
            if (_CurPoint != null)
            {
                _Form._MIM._KiaPoint.Add(_CurPoint._index);
                _Form.listBox_KiaPoint.Items.Add(_CurPoint);
            }
        }


        public override void MouseClick(MouseButtons button, double x, double y)
        {
            _CurPoint = _Form._MIM._BaseNode.GetPoint(x, y);

            if (_CurPoint != null)
            {
                _Form.propertyKiaPoint.SelectedObject = _CurPoint;
            }

        }

        public override void Draw(Graphics g)
        {


            if (_CurPoint != null)
            {
                g.DrawEllipse(_Cur_Pen, (float)_CurPoint._GPSPos.X - 3, (float)_CurPoint._GPSPos.Y - 3, 6, 6);
                


            }
        }


    }
}
